﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Tracker;
using NSubstitute;
using FluentAssertions;
using Tracker.Services;
using Tracker.Data.DataTransfer;
using System.Collections.Generic;
using Tracker.Views;

namespace UnitTestTracker
{
   
    [TestClass]
    public class TrackerPresenterTest
    {
        //public TestContext testcontext { get; set; }

        private ITaskData taskdata ;
        private ITrackerView trackerview ;

        [TestInitialize()]
        public void Initialize()
        { 
           taskdata =  Substitute.For<ITaskData>();
           trackerview = Substitute.For<Tracker.Views.ITrackerView>();
        }

        [TestMethod]
        public void ConstructorTest()
        {
            taskdata.GetStatusDomainList().Returns<List<StatusDomain>>(new List<StatusDomain>());

            Action act = () => { Tracker.Presenters.ITrackerPresenter tp = new Tracker.Presenters.TrackerPresenter(taskdata, trackerview); };
            act.ShouldNotThrow();

            //population
            var p = new Tracker.Presenters.TrackerPresenter(taskdata, trackerview);

            trackerview.DetailCreateTimeStart.Should().BeOnOrBefore(DateTime.Now);
            trackerview.FilterStatusSource.Should().NotBeNull();

          

        }
        
    }
}
